#pragma once
#include <pthread.h>

class Mutex
{
public:
    Mutex(pthread_mutex_t *_lock)
    {
        m_lock = _lock;
    }

    void Lock()
    {
        pthread_mutex_lock(m_lock);
    }

    void unLock()
    {
        pthread_mutex_unlock(m_lock);
    }

private:
    pthread_mutex_t *m_lock;
};

class LockGuard
{
public:
    LockGuard(pthread_mutex_t *_lock)
    :m(_lock)
    {
        m.Lock();
    }

    ~LockGuard()
    {
        m.unLock();
    }

private:
    Mutex m;
};
